package com.lam.fundamental;

import android.app.Activity;
import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;

public class RadioGroupDealActivity extends Activity{

	
	private RadioGroup rGroup;
	private RadioButton radioButton1;
	private RadioButton radioButton2;
	private RadioButton radioButton3;
	private TextView tView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.radioselectdeal);
		tView=(TextView)findViewById(R.id.tv_radioSelect);
		rGroup=(RadioGroup)findViewById(R.id.rg_select);
		radioButton1=(RadioButton)findViewById(R.id.rb_free);
		radioButton2=(RadioButton)findViewById(R.id.rb_fish);
		radioButton3=(RadioButton)findViewById(R.id.rb_money);
		rGroup.clearCheck();
		rGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			
			@Override
			public void onCheckedChanged(RadioGroup group, int checkedId) {
				// TODO Auto-generated method stub
				if(checkedId==radioButton1.getId()){
					tView.setText("Good");
				}else if(checkedId==radioButton2.getId()){
					tView.setText("pool");
				}else if(checkedId==radioButton3.getId()){
					tView.setText("mean");
				}
			}
		});

	}
	
}
